package com.qd.dict.panda;

import com.cdqidi.dict.annotation.FieldBind;
import com.cdqidi.dict.config.IFieldProcess;
import com.qd.common.dict.DictConstant;
import com.qd.panda.service.stroke.DisplayUtil;
import lombok.RequiredArgsConstructor;
import org.springframework.stereotype.Component;

/**
 * 退款状态
 *
 * @author sjk
 */
@Component
@RequiredArgsConstructor
public class RefundStateProcessImpl implements IFieldProcess {

    @Override
    public String processName() {
        return DictConstant.REFUND_METHOD;
    }

    @Override
    public Object convertValue(FieldBind fieldBind, Object fieldValue) {
        if (null == fieldValue) {
            return "";
        }
        int value = Integer.parseInt(fieldValue.toString());
        if (value == DisplayUtil.REFUND_STATUS_0) {
            return "申请退款";
        }
        if (value == DisplayUtil.REFUND_STATUS_1) {
            return "退款成功";
        }
        if (value == DisplayUtil.REFUND_STATUS_2) {
            return "退款失败";
        }
        return "";
    }
}